<template>
  <div v-show="product.length>=1">
    <div class="fund_text">
      <span >理财精选</span>
      <div class="icon">
        <van-icon name="arrow" size="22px"/>
      </div>
    </div>
    <div
      class="fund-items"
    >
      <div
        v-for="(item, idx) in product"
        :key="idx"
        class="fund-item"
        v-show="item.product_interest_rate"
      >
        <div class="fund-item-icon">
          <img :src="require('@/assets/img/home/NO' + (idx + 1) + '.png')">
        </div> 
        <div class="fund-item-cen" >
        <span class="item-cen-ratio">{{item.product_interest_rate | rateFilter}}</span>
        <span class="item-cen-text">年利率</span>
        </div>
        <span class="fund-item-fond">
          {{item.product_name}}
        </span>
      </div>
    </div>
  </div>
</template>

<script>
import {getAfeaturedProduct} from '@/api/product'
export default {
  name:"prefund",
  data(){
    return {
      product:[
        {
          product_interest_rate:'',
          product_name:''
        }
      ],
    }
  },
  created(){
    this.getFeaProduct()
  },
  filters:{
    rateFilter(value){
      return value + "%"
    }
  },
  methods:{
    getFeaProduct(){
      getAfeaturedProduct().then(res=>{
        this.product = res.data.list
      })
      
    }
  }
}
</script>

<style lang="less">
.fund_text {
  margin: 10px auto;
  margin-top: 25px;
  width: 85%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  span {
    color: rgba(16, 16, 16, 100);
    font-size: 20px;
    text-align: left;
    font-family: PingFangSC-regular;
  }
}
.fund-items {
  margin: 10px auto;
  margin-bottom: 15px;
  width: 90%;
  // width: 330px;
  height: 250px;
  border: 1px solid red;
  line-height: 20px;
  border-radius: 15px;
  color: rgba(16, 16, 16, 100);
  font-size: 14px;
  text-align: center;
  box-shadow: 0px 2px 6px 0px rgba(49, 45, 45, 0.4);
  font-family: Arial;
  border: 1px solid rgba(187, 187, 187, 100);
  background-color: #FFFFFF;
}
.fund-item {
  display: flex;
  align-items:center ;
  width: 100%;
  height: 60px;
  margin-top: 15px;
  border-bottom: 1px solid rgb(202, 202, 202);
  // border-bottom-width:100px
}
.fund-item .fund-item-icon {
  display: flex;
  align-items:center ;
  margin-left: 5px;
  width: 45px;
  height: 100%;
  text-align: center;
  font-size: 20px;
}
.fund-item .fund-item-cen {
  display: flex;
  flex-direction:column ;
  width: 80px;
  height: 100%;
  margin-left: 35px;
}
.item-cen-ratio {
  margin-top: 15px;
  font-size: 20px;
  color: red;
  font-family: PingFangSC-regular;
}
.item-cen-text {
  font-family: PingFangSC-extraLight;
}
.fund-item-fond {
  height: 25px;
  // line-height: 20px;
  margin-left: 25px;
  // padding-right: 20px;
  font-size: 18px;
  font-family: PingFangSC-regular;
  text-overflow:ellipsis;
  overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap
}
</style>
